<?php

namespace maotool\util;

use maotool\file\DirUtil;
use maotool\log\Console;
use maotool\object\ReflectionUtil;
use ReflectionClass;

class ControllerUtil
{

    /**
     * @return void
     */
    public static function scan($path)
    {
        $log_time_start = microtime(true);
        $list = DirUtil::scanFiles($path);
        \maotool\log\Console::debug('Controller Path 扫描 ' . $path . ' 加载用时：' . number_format(microtime(true) - $log_time_start, 10) . ' 秒。');
        foreach ($list as $item) {
            require_once $item["path"];
            ContainerUtil::set(["concrete" => ReflectionUtil::getClass($item["path"]), "init" => false]);
        }
    }

}